Hong Kong rule uploaded

under testing...

Oliver 2019-07-24T15:59:21Z

Oliver,

So far so good except I've won off discard twice and the payment was equal amongst everyone including those that were not discarder.

It should be 1x for discarder and 50% for others.

Also, it's just a hunch but I noticed earlier I got 7 pairs and I know that concealed is implied for 7 pairs but was wondering if the win is self drawn will it add the +1 fan?

Jayrocs 2019-07-24T21:15:57Z

Also Oliver, you have a prevailing wind in Riichi already - Hong Kong needs the same thing.

Also, there's a dead wall of 14 tiles right?

Jayrocs 2019-07-24T21:57:58Z

Hi Oliver another bug. The bot just won with fully melded hand with self draw. Fully melded hand must be from discard only and cannot win off self draw. If it is self drawn then it is not fully melded.

Sorry for rapid messages just typing things as I catch them.

Thanks.

Jayrocs 2019-07-24T22:02:40Z

Discovered another error in the scoring.

Three Concealed Pungs is 1 fan. This should be worth 3 fan, similar to how Zung Jung has concealed pungs. Concealed Kongs can still count as concealed pungs as well.

Also it is missing a limit hand called All Honors. There is All Terminals in there but not All Honors.

Thanks.

Jayrocs 2019-07-24T22:14:16Z

Game 929 - Bot picked up a West tile and then decided to never move. The tile just kept blinking, maybe lag or broken bot? The wests were already pung and maybe because of high minimum point of 5 it didn't know what to do?

Not sure just reporting bot crash.

Jayrocs 2019-07-24T22:29:52Z

Last message from me today Oliver to give you some time but I really do think something is up with the initial tile shuffling/randomization.

My starting tiles are just always consistently good, almost impossible that I always start with hands like this. Not only that but the bots as well, every bot is always calling it just seems like everyone is dealt a hand that is mostly completed already and not fully randomized.

Jayrocs 2019-07-24T22:35:36Z

This is what you said about the shuffling issue last time:

"The tiles are shuffled when a hand starts, then it is fixed during the hand. The shuffle method is pure PNG using uniform random number generator, which is pretty standard."

Are the tiles shuffled, then the wall built, then the tiles handed out in stacks of 2 (4 tiles) as it's distributed?

Or are tiles given out 13 at a time to players? Meaning 13 in a row? I think there's just something wrong because I've never had a garbage hand that I can't do anything with, let alone mediocre hands. I always have something mostly connected and almost formed.

The tiles should be shuffled and ordered then given out to every player 4 at a time. Since it's program you can probably just get away with every single tile being RNG but given to each player 1 at a time.

Don't mean to doubt your programming or anything but every app I've played on and in real life, I've never encountered so many back to back good hands repeatedly always being very close to a ready hand from the deal. If there is a way I think it needs to be randomized further, shuffled further.

Also, is there a dead wall?

Jayrocs 2019-07-24T22:43:29Z

there is a dead wall of 14 tiles as the zung jung rule. No dead wall in hong kong rule, right? will change that.

Oliver 2019-07-24T22:50:07Z

about shuffling, if you see the initial hands from game replay, the initial hands seems well randomized to me. The RNG algorithm does not seem buggy to me. but I will keep it in mind.

Oliver 2019-07-24T22:52:20Z

Hi, Jayrocs, the payoff is not done yet. when you see additive, do you mean the score of a hand is the sum of all fans? shall it be the doubled by the times of fans like the kaan-table?

Thanks for reporting the bugs, very useful. it will take some time to polish the game.

Oliver 2019-07-24T22:59:12Z

if it is stuck, it is a crash. that is why it still needs testing.

Oliver 2019-07-24T23:01:01Z

Okay well it's okay as it is again I just don't understand how luck it seems everyone's hands are.

There are shuffling algorithms I think you can steal, not important now since I know you are busy but Tenhou.net publishes their API I believe in how they shuffle their tiles.

They use Mersenne twister random generator. If you are interested here's the link on post #515:

https://tl.net/forum/games/111078-mahjong-tenhou-thread?page=26

Don't mean to rush you Oliver you may not need to do any of this, potentially just give the tiles out 4 at a time in counter clockwise order and maybe that in itself is good enough for the shuffle.

Thanks.

Jayrocs 2019-07-24T23:03:58Z

Yes additive like Zung Jung. No need to add Faan Laak table yet. If you add that later have it as an option. So no doubling.

And yes it should be 1x for discarder and 50% for the rest payment. Or on self draw 1x for all 3 so 3x payment.

So then just the incorrect hands is really the only thing. Fully Melded = Must be won on discard and a bot got that on me with a self draw. There is missing All Honors from the list not sure if you added it anyway. And Three Concealed Pungs should be worth 3 fan.

Jayrocs 2019-07-24T23:06:45Z

Sorry this thread already got cluttered from all my messages but prevailing wind as well needs to be added.

Thanks again.

Jayrocs 2019-07-24T23:09:02Z

The messages are helpful really. I will look at Thehou's shuffling algorithm. But again, please take a look at the initial hands of previous games in this link: https://maque.games/history

those initial hands seem to be reasonable to me. please check them out.

Oliver 2019-07-24T23:18:41Z

the current shuffling algorithm: random pick a tile using system random generator, put it to the head of the wall. do it again until there are all tiles are in the wall. Assume the system random generator is truly random, the wall is truly random in theory. Those are technique details, in case you are interested.

Oliver 2019-07-24T23:25:15Z

Ok thanks for explaining Oliver. Maybe it's just my imagination but I've never had this feeling before about the shuffling in any app I've played.

Having the wall fully built and then giving out the tiles 4 at a time to the players would cause a secondary shuffle that may be the difference.

Sorry for the trouble Oliver.

Jayrocs 2019-07-24T23:47:58Z

About Self Draw: all hands won by self draw get one fan added, including 7 pairs, fully concealed hand

Oliver 2019-07-25T01:31:59Z

updated:

  • fixed full melded hand
  • added 3 concealed pungs 3 fan
  • chicken hand 0 fan, means 0 points for every body?
  • payoff implemented
  • no dead wall
  • add all honors
Oliver 2019-07-25T00:56:37Z

I suppose you can make chicken hands 1 fan for the people who play with 0 minimum.

Jayrocs 2019-07-25T03:09:06Z

Also prevailing wind/round win the same way the Riichi Mahjong is setup. I'll keep testing.

Jayrocs 2019-07-25T03:11:10Z

Oliver, theres something up with the score screen now when hand is done. I don't click on it and it just skips through as if the timer is 1 second or so. Usually happens when the bot wins.

I just played a hand where I got pure double chow and a mixed double chow in the same hand. I was only given the points for the pure double chow 2 fan but not the mixed chow meaning 2 chows same numbers but different suits.

I'm wondering now if mixed straight and the other hands work properly gonna try aiming for them. Like 3 shifted chows only 2 suits etc.

Jayrocs 2019-07-25T03:24:32Z

I notice that the definitions on that site for Mixed Shifted Chows and Pure shifted chows says shifted up 1 or 2 tiles.

It should be shifting by 1 only. Don't allow the 2 tile shift. So the shifting pungs should be like 123, 234, 345. Same suit for pure and 3 suits for mixed.

Two-Suited Shifted Chows is similar to mixed triple chow but 2 suits. Same concept though only shifting by 1 tile each set.

Jayrocs 2019-07-25T03:30:06Z

Okay just lost a hand to the bot who scored 2 fan for 2 suited shifted triplets however it was only 888c, 999c, and WWW.

It should be 3 triples shifting not sure how the West pung got counted as part of it.

Jayrocs 2019-07-25T03:34:15Z

Bot just scored 3 concealed pungs on me but only got 1 fan for it + 3 fan for all pungs. Maybe I didn't clear cache but that was supposed to be worth 3 fan for concealed + 3 fan for all pung. I'm free at nights so sorry for rapid comments again Oliver just trying to write things down as they happen to keep track.

Jayrocs 2019-07-25T03:47:07Z

Bot just scored 3 concealed pungs on me but only got 1 fan for it + 3 fan for all pungs. Maybe I didn't clear cache but that was supposed to be worth 3 fan for concealed + 3 fan for all pung. I'm free at nights so sorry for rapid comments again Oliver just trying to write things down as they happen to keep track.

Another one, bot just got Blessing of Earth on me 18 fan + single chance + special eyes.

Blessing of Earth is the same thing as Blessing of Heaven except its for the non dealer. This happened on the 3-4th turn, the blessing hands must happen on the very first turn. Not sure how this happened.

Second though, Blessing of Earth is a limit hand so it should have stopped at 18 fan and not counted anything else.

Jayrocs 2019-07-25T03:53:04Z

Double Pung doesn't seem to be working either. Having two pungs of the same number so 888 characters and 888 bamboo did not count for double pung.

Jayrocs 2019-07-25T03:56:29Z

Okay as far as hands go I haven't run into much since what I've posted above but I haven't been able to get a mixed straight or 2 suit straight yet.

On second thought, 2 chows same numbers 2 suits - just leave this off. It doesn't need to be added.

The scoring though there are hands that don't add up correctly. For instance 3 fan win on a discard. Player is paid 6 points but it only takes away -3 from the discarder and -1 from each so 6 points are given out but only 5 points are taken away. There is a problem when counting points in end game since more points are given out than taken away.

Thanks.

Jayrocs 2019-07-25T04:27:13Z

So to bullet point all the things I noticed tonight:

  1. Scoring is not equalized. More points are given than taken away. When someone wins with 3 fan on a discarder they are given 6 points but the discarder is only -3, and the other two -1 making it -5. So 6 points and only -5 for payment.

  2. Blessing of Earth and Limit payments are not right. Blessing of Earth somehow occurred on the 4-5th hand and gave 18 + self draw + special eyes. Blessing of Earth itself is messed up but Limit is 18 fan so nothing should be able to go past 18 fan either by counted limit or actual hands worth 18.

  3. Shifted Pungs are not working. Bot had 888, 999 same suit and then WWW and somehow got 2 suited shifted pungs.

  4. Double Pung is not working. Two pungs of the same number so 888 bamboo, and 888 circles is worth 1 fan. Right now it is not recognizing it at all.

  5. Concealed Triplets/Pungs is still only awarding 1 fan. It should be 3.

  6. The wording on the website for shifted chows said shifting by 1 or 2 tiles. Keep it as shifting only by 1 tile. Shifted chows and shifted pungs are always in 3 sets shifting as well, never two.

  7. I originally thought mixed double chow should be fixed but on second thought it should stay off as it's a little too easy to complete and doesn't belong on the list.

Sorry for blowing up the forums like this but you finished the HK New Style so fast I got excited and tested it a bunch.

Jayrocs 2019-07-25T04:40:15Z

Since there seems to be problems with some of the two-suited things Oliver maybe just delete them to make it easier.

They're not really needed anyway and kind of confuse. I'd suggest just removing these from the list of patterns:

1.Two-Suited Straight 2.Two-Suited Shifted Chows 3.Two-Suited Shifted Pungs

This way everything is either pure (all same suit) or mixed (all 3 suits) and nothing in between.

Jayrocs 2019-07-25T05:19:40Z

My friend just got a half flush hand that also awarded him with voided suit. Voided suit doesn't allow honors so they can never stack together.

Jayrocs 2019-07-25T05:31:12Z

Game 974 - Hand 1: Friend won with a full flush, pure shifted chows, 4 in 1, 2 identical chows, and self draw.

There was no Pure shifted chows in his hand. Something is wrong with pure shifted chows.

Game 974 - Hand 3 - Friend won with fully concealed hand and was given the self draw bonus a second time. I think what's happened is you're giving self draw a + 1 always when it happens so maybe you had fully concealed at only 2 fan. I forgot the points but this might be the reason that someone was able to score over 18 points in another hand cuz it was Limit + Self Draw which is always + 1 even when it is implied in the hand.

Thanks.

Jayrocs 2019-07-25T06:10:54Z

some notes:

  1. discard immunity: using zung jung rule. it is complicate
  2. pure shifted chow fixed
  3. I am currently added 1 fan for self-draw always. shall the fully concealed hand not count self-draw? what else cases shall self-draw be excluded in?
  4. one voided suit: fixed
null 2019-07-25T08:13:34Z

  1. added prevalent wind, dealer rotate (or not)
  2. remove 2 suit stuff
Oliver 2019-07-25T08:27:06Z

Fully concealed on self draw = 3 fan. So it is implied already.

Concealed hand win on discard is only 1 fan. So they are two different hands.

The way you have it kind of works out but the problem is that the limit at 18 is not working properly since self draw is always adding +1 it gives limit (18) + 1. The cap should be at 18 doesn't matter what things add up to.

And then really the only other problem is the points not matching up. If it is easier Oliver, just do 3x on self draw and 2x on discarder if the half payment rounded down is too complicated.

Jayrocs 2019-07-25T18:34:24Z

I cleared my cache and don't see the prevalent wind maybe it appears after 4 hands?

Dealer should rotate after every hand, don't allow repeats just cuz of win or draw.

Thanks.

Jayrocs 2019-07-25T20:40:58Z

prevalent wind is added, but it is not displayed yet. I have done the dealer not to rotate when win or draw, because the wiki site says so.

Oliver 2019-07-25T23:15:47Z

the points should add up matching now, not a problem.

Oliver 2019-07-25T23:16:47Z

Hey Oliver, mixed double sequences appeared in a hand just now for 1 fan.

This should be deleted. I think this is two same chows in 2 suits. This shouldve been part of the whole removing all the two suit hands.

Jayrocs 2019-07-25T23:52:57Z

The scoring works properly as well and good to know round win works just need to keep track of the seat winds yourself.

If you've figured out why Blessing of Earth happened on the 5-6th turn and fixed the fan limit to be 18 and not go over for any reason I think everything's pretty much been handled.

Game still crashes or lags out every so often though, maybe it has something to do with bots. I'll try to test it out with 4 real players and play more than 8 hands.

Thanks.

Jayrocs 2019-07-25T23:54:59Z

Scoring correction for Small Three Dragons and Probably 3 big dragons and the 3-4 big winds/small winds.

3 Small Dragons already implies dragons in the hand so you don't also get the dragon pungs inside.

Jayrocs 2019-07-26T00:05:20Z

Meaning small dragons is already 6 fan. So small dragons + self draw + half flush = 6 + 1 + 3 = 10 fan only. Right now it is scoring 12 fan because of 2 value honors being included.

Jayrocs 2019-07-26T00:07:09Z

I deleted the 2 suit stuff... the blessing of earth is fixed now, the score is set to 18 when it exceeds. the bugs should be much less now! Cheers!

Oliver 2019-07-26T00:08:14Z

Okay so mixed double sequences for 1 fan is deleted right?

Cool. Double pungs are still not in, not sure if that was lost in all my pages of comments.

Double pung = 1 fan, when you have a pung of the same number twice it's worth 1 fan. So pung of 8 bamboo and then a pung of 8 dots = 1 fan.

Thanks.

Jayrocs 2019-07-26T00:26:27Z

I deleted 2 suit straight, 2 suit shifted sequences, 2 suit shifted triplets. probably will add them again when I feel confident... double pung is added

Oliver 2019-07-26T01:11:28Z

I think the hong kong rule is pretty much done so far. Thanks for helping testing and explaining the rules, Jayrocs!

Oliver 2019-07-26T01:31:52Z

Thanks for making it Oliver

Jayrocs 2019-07-26T03:15:12Z

Game 1029 hand 1 - Don't think prevalent wind is in still because I had a Kong of East as East round 1.

Pung of East during East round is 2 fan, 1 for the seat and 1 for the round. Then Kong that makes it 3. A bot dropped my winning tile and it didn't alert me of a win and just kept going.

So I don't think that the round wind is working properly, either not detecting or not doubling up when it matches the seat wind.

Thanks

Jayrocs 2019-07-26T03:27:39Z

Hi Oliver, the Value for Fully Melded hand should be 3 instead of 2.

Thanks.

Jayrocs 2019-07-26T05:59:30Z

The prevalent wind bug is fixed. The wiki site says the fully melded hand is 2 fan.

Oliver 2019-07-27T05:33:13Z

I added the 2 suit items... fixed a mixed double chow bug

Oliver 2019-07-27T05:34:12Z

Sorry Oliver, I meant fully concealed hand should be 3 fan not 2.

Fully melded is correct at 2.

Thanks.

Jayrocs 2019-07-27T07:18:13Z